import { DatePicker } from 'antd';
import { Button, Input, Modal, Form } from 'antd'
// import Input from 'rc-input';
import React, { useState } from 'react';
import { getinto_list_search } from '../../../utils/api/zqq/index'

import '../../../styles/qqiang/getinto.scss'
interface Props {
    changelossList: any
    datacreate: Function
    getintolist: Function
}

function GetintoTop(props: Props) {
    const [form] = Form.useForm();
    const [data, setData] = useState('')
    // search
    const search = () => {
        console.log(data);
        getinto_list_search({ renyuan: data }).then((res: any) => {
            console.log('search', res.data)
            props.changelossList(res.data)
        })
    }
    const handlenchange = (event: any) => {
        const { value } = event.target
        setData(value)
        console.log(event.target);
    }
    //创建
    var [isModalOpen_2, setIsModalOpen_2] = useState(false)
    // 创建客服弹窗显示
    const showModal = () => {
        setIsModalOpen_2(true)

    };
    const handleCancel_2 = () => {
        setIsModalOpen_2(false);
    };
    // 创建客服
    var onFinish_2 = (values: any) => {
        console.log('edit');
        props.datacreate(values)
        setIsModalOpen_2(false);
        // staff_edit(values).then((res: any) => {
        //     if (res.data.code == 200) {
        //         message.success('更新成功');

        //         setIsModalOpen_2(false)
        //     } else {
        //         message.error('更新失败');
        //     }
        // })

    };
    return (
        <div className='getinto'>
            <div className='getintotop'>
                仓储管理 / 入库管理 / 入库列表
            </div>
            <div className='getintoinput'>
                <Input placeholder="请输入单号" />
                <Input defaultValue={data} onChange={handlenchange} placeholder="请输入入库人员" />
                <Input placeholder="请输入仓库" />
                {/* <Input placeholder="请输入申请日期" /> */}
                <DatePicker className="ant-input" placeholder="请选择申请日期" />
                <Input placeholder="请选择状态" />
                <Button onClick={search} type="primary">搜索</Button>
                <Button type="primary" onClick={showModal} >创建</Button>
                <Button type="primary">导出</Button>
            </div>
            {/* 创建弹窗 */}
            <Modal forceRender={true} title="新增客服" footer={null} open={isModalOpen_2} onCancel={handleCancel_2}>
                <Form onFinish={onFinish_2} form={form}>
                    <Form.Item
                        name="key"
                        rules={[
                            {
                                required: true,
                                message: '请输入唯一标识key!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入唯一标识key" />
                    </Form.Item>
                    <Form.Item
                        name="cangku"
                        rules={[
                            {

                                required: true,
                                message: '请输入仓库!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入仓库" />
                    </Form.Item>

                    <Form.Item
                        name="danhao"
                        rules={[
                            {
                                required: true,
                                message: '请输入单号!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入单号" />
                    </Form.Item>

                    <Form.Item
                        name="renyuan"
                        rules={[
                            {
                                required: true,
                                message: '请输入人员!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入人员" />
                    </Form.Item>

                    <Form.Item
                        name="shenheren"
                        rules={[
                            {
                                required: true,
                                message: '请输入审核人!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入审核人" />
                    </Form.Item>
                    <Form.Item
                        name="shenhetime"
                        rules={[
                            {
                                required: true,
                                message: '请输入审核时间!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入审核时间" />
                    </Form.Item>
                    <Form.Item
                        name="time"
                        rules={[
                            {
                                required: true,
                                message: '请输入创建时间!',
                            },
                        ]}
                    >
                        <Input placeholder="请输入创建时间" />
                    </Form.Item>
                    <Form.Item
                        name="zhuangtai"
                        rules={[
                            {
                                required: true,
                                message: '更新状态',
                            },
                        ]}
                    >
                        <Input placeholder="更新状态" />
                    </Form.Item>
                    <Form.Item>
                        <Button block type="primary" htmlType="submit" shape="round">
                            确认更新
                        </Button>
                    </Form.Item>
                </Form>
            </Modal>
        </div>
    );
}

export default GetintoTop;